home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / N-P / OmniScript 2.0.1 / Examples / Finder Examples / Folder Organizer < prev   
Encoding:
Text File  |  1993-09-28  |  2.0 KB  |  107 lines  |  [TEXT/ExPr]

  1. *
  2. * This script organizes a folder in the following way
  3. *        the view is small icon
  4. *        the items are organized into four different groups
  5. *            1. Applications and application aliases
  6. *            2.    Files and their aliases
  7. *            3.    Folders and their aliases
  8. *            4.    Volume aliases
  9. *        the different groups are displayed above each other
  10. *        each group has three columns
  11. *
  12. if #sys < '0700'
  13.     display 'This script requires System 7'
  14.     exit
  15. end
  16. *
  17. * Select the folder
  18. *
  19. dir
  20. test (#ret) exit
  21. *
  22. * Create an alias for the folder
  23. *
  24. b = 1
  25. alias b[0] =,
  26. *
  27. *    Set the view for the window
  28. *    Close the Finder window and wait a bit for it to save results
  29. *    This is to ensure that the volume info is the same as the Finder info
  30. *
  31. finder view,b[0],small
  32. finder close,b[0]
  33. wait none 5
  34. *
  35. * Now scan the files in this folder and build the list
  36. *
  37. i = 0
  38. total = 0
  39. count[1] = 0
  40. count[2] = 0
  41. count[3] = 0
  42. count[4] = 0
  43. do
  44.     inc i
  45.     file a = i
  46.     test (#ret) quit
  47.     if (#file(inv)) 
  48.         beep
  49.         display 'invisible:'a
  50.         cycle
  51.     end
  52.     if (#file(locked))
  53.         accept tt,'Unlock 'a'?'
  54.         if #ret = 0
  55.             change locked=0
  56.             info
  57.             lock = 1
  58.         else
  59.             display 'locked:'a
  60.             cycle
  61.         end
  62.     else
  63.         lock = 0
  64.     end
  65.     if #file(type) = 'APPL' | #file(type) = 'adrp'
  66.         x = 1
  67.     else if #file(type) = 'srvr' | #file(type) = 'flpy' | #file(type) = 'hdsk' 
  68.         x = 4
  69.     else if #file(type) = 'DIR ' | #file(cre)  = 'MACS'
  70.         x = 3
  71.     else
  72.         x = 2
  73.     end
  74.     inc count[x]
  75.     inc total
  76.     num[x][count[x]] = i
  77.     lockit[x][count[x]] = lock
  78.     ver[x][count[x]] = #file(ver)
  79.     hor[x][count[x]] = #file(hor)
  80.     name[x][count[x]] = a
  81.     display #f(total,3,0)':'#file(type)':'#file(cre)':'a
  82. end
  83. *
  84. *    Open the Finder window
  85. *
  86. front sign='MACS'
  87. finder show,b[0]
  88. *
  89. v = -16
  90. block = 0
  91. do while block < 4
  92.     inc block
  93.     test (count[block] = 0) cycle
  94.     v = v + 20
  95.     rows = (count[block] + 2)/3
  96.     j = 0
  97.     do while j < count[block]
  98.         tv = v + 20*(j%rows)
  99.         h = 125*(j/rows)
  100.         inc j
  101.         alias b[1] = ,name[block][j]
  102.         finder move,b,ver=(tv-ver[block][j]),hor=(h-hor[block][j])
  103.     end
  104.     v = v + 20*rows
  105. end
  106.  
  107. finder sizewindow,b[0],height=v+35,width=395